<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<tiles:importAttribute/>
<html>
<head>
<title>JFEED TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
.rss_publisher .tableInit tr{
	margin:10px 0;
}
.rss_publisher .tableInit td{
	border:0;
}
.rss .rss_button{
	width:120px;
}
</style>
</head>
<body>
     <div id="${PORTLET_INSTANCE_ID }" class="module moduleStandard moduleCollapsible" portletId="${PORTLET_INSTANCE_ID } ">
                    <!-- portlet head -->
                    <div class="moduleHeader" >
                        <div class="moduleHeaderContent clear">
                                <div class="title-link">
                                <a>${title }</a>
                            </div>           
                        </div>
                    </div>
                    <!-- portlet body -->
                    <div class=moduleBody style="border-left:1px solid #eee;border-right:1px solid #eee;">
                        <div class="moduleBodyContent"  id="${PORTLET_INSTANCE_ID }_content">
                        	<div class="rss_publisher">
                        		<table class="tableInit">
						       		<tr>
						       			<td>RSS Feed Name:</td>
						       			<td><input id="feed_name" type="text" /></td>
						       			<td>RSS Feed Desc:</td>
						       			<td><input id="feed_desc" type="text" /></td>
						       			<td><input id="create_feed" class="rss_button" type="submit" value="Create Feed RSS"/></td>
						       			<td>&nbsp;</td>
						       			<td>&nbsp;</td>
						       		</tr>
								</table>
								<div class="rssFeedList">
									<jsp:include page="/goal/rssReader!getRSSFeed.action"></jsp:include>
								</div>
								<table class="tableInit">
						       		<tr>
						       			<td>Entry Name:</td>
						       			<td><input type="text" /></td>
						       			<td>Entry Link:</td>
						       			<td><input type="text" /></td>
						       			<td>Entry Desc:</td>
						       			<td><input type="text" /></td>
						       			<td><input class="rss_button" type="submit" value="Publish Feed RSS"/></td>
						       		</tr>
								</table>
								<div class="rssEntryList">
									ddd
								</div>
                        	</div>
                        </div>
                   </div>
                   <div class=roundedCorners>                  
                            <div class=roundedCorners-inner></div>           
                    </div>
                </div>
</body>
<script type="text/javascript">
$(function(){
	var rss_publisher_portlet = $('#${PORTLET_INSTANCE_ID }');
	rss_publisher_portlet.find('#create_feed').bind('click',function(){
		var feed_name = rss_publisher_portlet.find('#feed_name').val();
		var feed_desc = rss_publisher_portlet.find('#feed_desc').val();
		if(feed_name != ''){
			var url = '${ctx}/goal/rssReader!createFeedRSSFile.action';
			$.ajax({
				   type: "POST",
				   url: url,
				   data: "rssFeedName="+ feed_name + '&rssFeedDesc='+feed_desc,
				   dataType: "html",
				   success: function(html){
					   rss_publisher_portlet.find('.rssFeedList').html(html);
				   }
				});
		}
		else{
			alert('Please input a feed name!');
		}
	});
});
</script>

</html>